/*
* INSANE - Interactive Structural Analysis Environment
*
* Copyright (C) 2003-2005
* Universidade Federal de Minas Gerais
* Escola de Engenharia
* Departamento de Engenharia de Estruturas
* 
* Author's email :    insane@dees.ufmg.br
* Author's website :  http://www.dees.ufmg.br/insane
* 
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package br.ufmg.dees.insane.ui.rich.learn.learn_view.command;
import javax.swing.JFrame;

/**
*
* @author Moreira, Renata & Pitangueira, Roque
* @since May 2005
*/
public class ShapeFunctionCommand implements Command{
	
	
//*****************************************************************************
	
    /** Constructor method. */
    public ShapeFunctionCommand(JFrame parent) {
    }
	
//*****************************************************************************
	
	/** The execute method.<br>
	* Prepares the Interface to receive data to add points.
	*/
    public void execute() {
    	
    }
    	/**
        parent.getView().getDrawingArea().setClickedCommand(new AddPointMouseCommand(parent));
        parent.getView().getDrawingArea().setRightClickedCommand(new SelectCommand(parent));
        parent.getView().getDrawingArea().setCursor();
		parent.getView().getDrawingArea().setShape(null);
		parent.getView().getDrawingArea().setMovedCommand(new DoesNothingCommand(parent));
		parent.getConsoleHandler().setToDataMode();
		parent.getConsoleHandler().setKeybCommand(new AddPointKeybCommand(parent));
		parent.addOutputText("Specify a point.");
		
		LearnInterface frame = new LearnInterface();
        frame.validate();
		//Centers the window
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = frame.getSize();
        if (frameSize.height > screenSize.height)
            frameSize.height = screenSize.height;
        if (frameSize.width > screenSize.width)
            frameSize.width = screenSize.width;
        frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
        
        
        XYPlot model = createSequence();
        frame.setModel(model);
      	frame.setVisible(true);
    }**/
	
//*****************************************************************************
	
	/** Impossible to undo - not implemented. */
    public void undo() {
    }
	
//*****************************************************************************
	
	/** Impossible to redo - not implemented. */
    public void redo() {
    }
    
//*****************************************************************************
    /**
    private XYPlot createSequence(){ 
        
        // criando eixos    
        IPoint3d originX = new IPoint3d(1.0, 1.0, 0);  
        IPoint3d endX= new IPoint3d(15.0, 1.0, 0);
        Axis xx = new Axis("X (m)",originX,endX);
        xx.setMainMark(2.5);
        
        IPoint3d originY = new IPoint3d(1.0, 1.0); 
        IPoint3d endY= new IPoint3d(1.0, 10.0);  
        Axis yy = new Axis("N(x)",originY,endY);
        yy.setMainMark(1.1);
        List axis = new ArrayList();
        
        //adicionando eixos
        axis.add(xx);
        axis.add(yy);

        ArrayList elms = parent.getController().getSelection();
		if ( elms.size() < 1 ) {
			parent.getController().selectAll();
			elms = parent.getController().getSelection();
		}
		
		if (elms.size() == 0) {
			parent.addOutputText("There is no elements in model.");
			return null;
		}
        
        List sequenceOne = new ArrayList();
        Element elm = (Element)parent.getController().getSelection().get(0);
        int npoints = 100;
    	double dx = 1.0/npoints;
    	double x, y;
    	double[] coords = new double[3];
        for(int i=0; i<npoints; i++){
        	coords[0] += dx;
        	y = elm.getShape().getShapeFunction(coords).getElement(0);	
        	IPoint3d pt = new IPoint3d(coords[0],y);
        	sequenceOne.add(pt);
        }

       IPoint3d inf1 = new IPoint3d(0.0,0.0);
       IPoint3d sup1 = new IPoint3d(10.0,10.0);

       ISequence seqOne = new ISequence("N1",sequenceOne, inf1,sup1);
       List seqList = new ArrayList();
       seqList.add(seqOne);
       
       XYPlot graphicTest = new XYPlot("Element Shape Function", axis, seqList);
       return graphicTest;
    }*/

}
